package Demo1.mapper;

import Demo1.bean.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface StudentMapper {
    //查
    @Select("select distinct * from student")
    public abstract List<Student> selectAll();

    //增
    //主键自增
    @Options(useGeneratedKeys = true, keyColumn ="id" ,keyProperty ="id" )
    @Insert("insert  into student values (#{id},#{name},#{age})")
    public abstract  Integer insert(Student stu);

    //改
    @Update("update student set name=#{name},age=#{age} where id=#{id}")
    public abstract  Integer update(Student stu);

    //删
    @Delete("delete from student where id=#{id}")
    public abstract  Integer delete(Integer id);

}
